﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
//using System.Web.Mvc;
//using Newtonsoft.Json;
//using hospital_management_system.ServiceReference1;
//namespace hospital_management_system.Controllers
//{
//    public class hospitalController : Controller
//    {
//        ServiceReference1.WebService1SoapClient client = new ServiceReference1.WebService1SoapClient();

<<<<<<< .mine
//        public ActionResult index()
//        {
//            return View();
//        }
//        // GET: hospital
//        public ActionResult Login()
//        {
||||||| .r27
        public ActionResult index()
        {
            return View();
        }
        // GET: hospital
        public ActionResult Login()
        {
            
            return View();
        }
        public ActionResult appendT_user()
        {
            return View();
        }
        [HttpPost]
        public ActionResult appendT_user(string U_Name, string U_Pwd, string U_Sex, int U_Age, string U_Phone, string U_IdCard)
        {
            return View();
        }
        public ActionResult T_Role()
        {
            var result = client.getdatatble();
            SelectList list = new SelectList(result, "Role_ID", "Role_Name");
            ViewBag.list = list;
            return View();
        }
        [HttpPost]
        public ActionResult T_Role(string Admin_Name, string Admin_Pwd, int Role_ID)
        {
          
                var result = client.appendAdmin(Admin_Name, Admin_Pwd, Role_ID);
                if (result > 0)
                {
                    return Content("< script > alert('保存成功请用此账号登录'); location.href = '/hospital/T_Admin' </ script >");
                }
                else
                {
                    return Content("< script > alert('账号和密码输入不正确'); location.href = '/hospital/T_Role' </ script >");
                }
           
        }
        [HttpPost]
        public ActionResult Login(string U_Name, string U_Pwd)
        {
            var result = client.T_User();
            var list = result.Where(p => p.U_Name == U_Name && p.U_Pwd == U_Pwd);
            foreach (var item in list.ToList())
            {
                Session["name"] = item.U_Name;
            }
            if(U_Name!=null ||U_Pwd!=null)
            {
                if (result != null)
                {
                    return Content("<script>location.href='/hospital/xianshi'</script>"); ;
                }
                else
                {
                    return Content("<script>alert('用户名或密码不对');location.href='/hospital/Login'</script>");
                }
            }
           else
            {
                return Content("<script>alert('账号或密码不能为空');location.href='/hospital/T_Role'</script>");
            }
        }
        public ActionResult T_Admin()
        {
            return View();
        }
        [HttpPost]
        public ActionResult T_Admin(string Admin_Name, string Admin_Pwd)
        {
            var result = client.T_Admin();
            var s1 = result.Where(p => p.Admin_Name == Admin_Name && p.Admin_Pwd == Admin_Pwd);
            foreach (var item in s1.ToList())
            {
                Session["name"] = item.Admin_Name;
                Session["id"] = item.Role_ID;
            }
            if (Admin_Name != null || Admin_Pwd != null)
            {
                if (s1 != null)
                {
                    return Content("<script>location.href='/hospital/xianshi'</script>");
                }
                else
                {
                    return Content("<script>alert('用户名或密码不对');location.href='/hospital/T_Admin'</script>");
                }
            }
            else
            {
                return Content("<script>alert('账号或密码不能为空');location.href='/hospital/T_Role'</script>");
            }
           
        }
=======
        public ActionResult index()
        {
            return View();
        }
        // GET: hospital
        public ActionResult Login()
        {

            return View();
        }
        public ActionResult appendT_user()
        {
            return View();
        }
        [HttpPost]
        public ActionResult appendT_user(string U_Name, string U_Pwd, string U_Sex, int U_Age, string U_Phone, string U_IdCard)
        {
            return View();
        }
<<<<<<< .mine
        //public ActionResult T_Role()
        //{
        //    var result = client.getdatatble();
        //    SelectList list = new SelectList(result, "Role_ID", "Role_Name");
        //    ViewBag.list = list;
        //    return View();
        //}
        [HttpPost]
        public ActionResult T_Role(string Admin_Name, string Admin_Pwd, int Role_ID)
        {
||||||| .r32
        //public ActionResult T_Role()
        //{
        //    var result = client.getdatatble();
        //    SelectList list = new SelectList(result, "Role_ID", "Role_Name");
        //    ViewBag.list = list;
        //    return View();
        //}
        //[HttpPost]
        //public ActionResult T_Role(string Admin_Name, string Admin_Pwd, int Role_ID)
        //{
<<<<<<< .mine
=======
        public ActionResult T_Role()
        {
            var result = client.getdatatble();
            SelectList list = new SelectList(result, "Role_ID", "Role_Name");
            ViewBag.list = list;
            return View();
        }
        [HttpPost]
        public ActionResult T_Role(string Admin_Name, string Admin_Pwd, int Role_ID)
        {
>>>>>>> .r33


            var result = client.appendAdmin(Admin_Name, Admin_Pwd, Role_ID);
            if (result > 0)
            {
                return Content("< script > alert('保存成功请用此账号登录'); location.href = '/hospital/T_Admin' </ script >");
            }
            else
            {
                return Content("< script > alert('账号和密码输入不正确'); location.href = '/hospital/T_Role' </ script >");
            }

<<<<<<< .mine


        }
||||||| .r32
||||||| .r24
          
                var result = client.appendAdmin(Admin_Name, Admin_Pwd, Role_ID);
                if (result > 0)
                {
                    return Content("< script > alert('保存成功请用此账号登录'); location.href = '/hospital/T_Admin' </ script >");
                }
                else
                {
                    return Content("< script > alert('账号和密码输入不正确'); location.href = '/hospital/T_Role' </ script >");
                }
           
=======
          
        //        var result = client.appendAdmin(Admin_Name, Admin_Pwd, Role_ID);
        //        if (result > 0)
        //        {
        //            return Content("< script > alert('保存成功请用此账号登录'); location.href = '/hospital/T_Admin' </ script >");
        //        }
        //        else
        //        {
        //            return Content("< script > alert('账号和密码输入不正确'); location.href = '/hospital/T_Role' </ script >");
        //        }
           
>>>>>>> .r30
        //}
=======



        }
>>>>>>> .r33
        [HttpPost]
        public ActionResult Login(string U_Name, string U_Pwd)
        {
            var result = client.T_User();
            var list = result.Where(p => p.U_Name == U_Name && p.U_Pwd == U_Pwd);
            foreach (var item in list.ToList())
            {
                Session["name"] = item.U_Name;
            }
            if (U_Name != null || U_Pwd != null)
            {
                if (result != null)
                {
                    return Content("<script>location.href='/hospital/xianshi'</script>"); ;
                }
                else
                {
                    return Content("<script>alert('用户名或密码不对');location.href='/hospital/Login'</script>");
                }
            }
            else
            {
                return Content("<script>alert('账号或密码不能为空');location.href='/hospital/T_Role'</script>");
            }
        }
        public ActionResult T_Admin()
        {
            return View();
        }
        [HttpPost]
        public ActionResult T_Admin(string Admin_Name, string Admin_Pwd)
        {
            var result = client.T_Admin();
            var s1 = result.Where(p => p.Admin_Name == Admin_Name && p.Admin_Pwd == Admin_Pwd);
            foreach (var item in s1.ToList())
            {
                Session["name"] = item.Admin_Name;
                Session["id"] = item.Role_ID;
            }
            if (Admin_Name != null || Admin_Pwd != null)
            {
                if (s1 != null)
                {
                    return Content("<script>location.href='/hospital/xianshi'</script>");
                }
                else
                {
                    return Content("<script>alert('用户名或密码不对');location.href='/hospital/T_Admin'</script>");
                }
            }
            else
            {
                return Content("<script>alert('账号或密码不能为空');location.href='/hospital/T_Role'</script>");
            }

        }
>>>>>>> .r31

<<<<<<< .mine
//            return View();
//        }
//        public ActionResult appendT_user()
//        {
//            return View();
//        }
//        [HttpPost]
//        public ActionResult appendT_user(string U_Name, string U_Pwd, string U_Sex, int U_Age, string U_Phone, string U_IdCard)
//        {
//            return View();
//        }
//        public ActionResult T_Role()
//        {
//            var result = client.getdatatble();
//            SelectList list = new SelectList(result, "Role_ID", "Role_Name");
//            ViewBag.list = list;
//            return View();
//        }
//        [HttpPost]
//        public ActionResult T_Role(string Admin_Name, string Admin_Pwd, int Role_ID)
//        {

//            var result = client.appendAdmin(Admin_Name, Admin_Pwd, Role_ID);
//            if (result > 0)
//            {
//                return Content("< script > alert('保存成功请用此账号登录'); location.href = '/hospital/T_Admin' </ script >");
//            }
//            else
//            {
//                return Content("< script > alert('账号和密码输入不正确'); location.href = '/hospital/T_Role' </ script >");
//            }

//        }
//        [HttpPost]
//        public ActionResult Login(string U_Name, string U_Pwd)
//        {
//            var result = client.T_User();
//            var list = result.Where(p => p.U_Name == U_Name && p.U_Pwd == U_Pwd);
//            foreach (var item in list.ToList())
//            {
//                Session["name"] = item.U_Name;
//            }
//            if (U_Name != null || U_Pwd != null)
//            {
//                if (result != null)
//                {
//                    return Content("<script>location.href='/hospital/xianshi'</script>"); ;
//                }
//                else
//                {
//                    return Content("<script>alert('用户名或密码不对');location.href='/hospital/Login'</script>");
//                }
//            }
//            else
//            {
//                return Content("<script>alert('账号或密码不能为空');location.href='/hospital/T_Role'</script>");
//            }
//        }
//        public ActionResult T_Admin()
//        {
//            return View();
//        }
//        [HttpPost]
//        public ActionResult T_Admin(string Admin_Name, string Admin_Pwd)
//        {
//            var result = client.T_Admin();
//            var s1 = result.Where(p => p.Admin_Name == Admin_Name && p.Admin_Pwd == Admin_Pwd);
//            foreach (var item in s1.ToList())
//            {
//                Session["name"] = item.Admin_Name;
//                Session["id"] = item.Role_ID;
//            }
//            if (Admin_Name != null || Admin_Pwd != null)
//            {
//                if (s1 != null)
//                {
//                    return Content("<script>location.href='/hospital/xianshi'</script>");
//                }
//                else
//                {
//                    return Content("<script>alert('用户名或密码不对');location.href='/hospital/T_Admin'</script>");
//                }
//            }
//            else
//            {
//                return Content("<script>alert('账号或密码不能为空');location.href='/hospital/T_Role'</script>");
//            }

//        }

//        public ActionResult xianshi()
//        {

//            ViewBag.data = client.T_Control(Convert.ToInt32(Session["id"]));

//            return View();
//        }
//        [HttpPost]
//        public ActionResult xianshi(int pageindex, int pagesize)
//        {
//            var result = client.T_Hospitalfenye(pageindex, pagesize, "Hosp_ID", "T_Hospital");
//            return Json(result);
//        }
//    }
//}||||||| .r27
        public ActionResult xianshi()
        {
            
            ViewBag.data = client.T_Control(Convert.ToInt32(Session["id"]));
           
            return View();
        }
        [HttpPost]
        public ActionResult xianshi(int pageindex, int pagesize)
        {
            var result = client.T_Hospitalfenye(pageindex, pagesize, "Hosp_ID", "T_Hospital");
            return Json(result);
        }
    }
}=======
        public ActionResult xianshi()
        {

            ViewBag.data = client.T_Control(Convert.ToInt32(Session["id"]));

            return View();
        }
        [HttpPost]
        public ActionResult xianshi(int pageindex, int pagesize)
        {
            var result = client.T_Hospitalfenye(pageindex, pagesize, "Hosp_ID", "T_Hospital");
            return Json(result);
        }
        public ActionResult T_Officekehsi()
        {
            ViewBag.data = client.T_Control(Convert.ToInt32(Session["id"]));
            return View();
        }
        [HttpPost]
        public ActionResult T_Officekehsi(int pageindex, int pagesize, string Office_ID, string T_Office)
        {
            var result = client.T_Officefenye(pageindex, pagesize, "Office_ID", "T_Office");
            return Json(result);
        }
        public ActionResult T_Doctoryisheng()
        {
            ViewBag.data = client.T_Control(Convert.ToInt32(Session["id"]));
            return View();
        }
        [HttpPost]
        public ActionResult T_Doctoryisheng(int pageindex, int pagesize, string Doctor_ID, string T_Doctor)
        {
            var result = client.T_Doctorfenye(pageindex, pagesize, "Doctor_ID", "T_Doctor");
            return Json(result);
        }
    }
}>>>>>>> .r31
